<template>
  <a-card>
    <a-table
      ref="table"
      size="middle"
      :scroll="{x:true}"
      bordered
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :loading="loading"
      :pagination="ipagination"
      class="j-table-force-nowrap"
      @change="handleTableChange"
    >
    </a-table>
  </a-card>
</template>

<script>
  import { getAction, postAction } from '@/api/manage'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'

  export default {
    name: 'ProductionProcessNotFinished',
    mixins: [JeecgListMixin, mixinDevice],
    data() {
      return {
        loading: false,
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '工单条码',
            align: 'center',
            dataIndex: 'workOrderBarCode'
          },
          {
            title: '完成情况',
            align: 'center',
            dataIndex: 'finishStatus_dictText'
          }
        ],
        dataSource: [],

        url: {
          list: '/mes/productionProcess/queryProcedureWorkOrderList'
        }
      }
    },
    methods: {
      loadData(arg) {
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1
        }

        const params = this.getQueryParams();
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          this.loading = false;
          if (res.success) {
            this.dataSource = res.result.records
            this.ipagination.total = res.result.total
          }else{
            this.$message.warning(res.message)
          }
        }).catch((err)=>{
          this.$message.warning(err.message)
        })
      },
      show(args) {
        for (const key in args) {
          this.queryParam[key] = args[key]
        }
        this.loadData(1)
      }
    }
  }
</script>

<style scoped>

</style>